﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using arthuraafn_xna_3d.AnimedModel;
using AnimationAux;

namespace arthuraafn_xna_3d.Base
{
    class AnimedGameObject3D:GameObject3D
    {
        /// <summary>
        /// Modelo animado
        /// </summary>
        AnimatedModel baseModel;
        AnimatedModel animation; 

        public AnimedGameObject3D(Game game, BasicCamera camera, Model model)
            : base(game, camera, model)
        {
            baseModel = new AnimatedModel(model);

            animation = new AnimatedModel(Game.Content.Load<Model>("Models/Teste/Victoria-hat-dance"));
            //animation = new AnimatedModel(Game.Content.Load<Model>("Models/Soldier/Soldier_animated_jump"));

            //AnimationClip clip = baseModel.Clips[0];
            AnimationClip clip = animation.Clips[0];

            // And play the clip
            AnimationPlayer player = baseModel.PlayClip(clip);
            //AnimationPlayer player = baseModel.PlayClip(clip);
            player.Looping = true;
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            baseModel.Update(gameTime);

        }

        public override void Draw(GameTime gameTime)
        {
            baseModel.Draw(Game.GraphicsDevice, camera, this.world);
        }
    }
}
